package com.cy.sdk.qiniu;

import com.cy.config.Config;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 13-11-27
 * Time: 下午1:22
 * 获取七牛空间的文件路径
 */
public class QiniuPath {

    public static String getAvatarPath(String key) {
        return Config.QiNiu.AVATAR_BUCKET_URL + key;
    }

    public static String getPublicPath(String key) {
        return Config.QiNiu.PUBLIC_BUCKET_URL + key;
    }

    /**
     * 图片尺寸路径生成
     *
     * @param path   访问路径
     * @param view   缩小模式 0 整图缩小, 1 裁剪缩小
     * @param width  宽
     * @param height 高
     * @return
     */
    public static String getSizePath(String path, int view, int width, int height) {
        StringBuffer sb = new StringBuffer();
        sb.append(path).append("?imageView/").append(view).append("/w/").append(width).append("/h/");
        sb.append(height).append("/q/85/format/jpg");
        return sb.toString();
    }
}
